package com.baidu.fenfayun.demo
import android.os.Bundle

import android.content.Intent
import com.baidu.yun.gameline.R
import com.baidu.fenfayun.demo.home.*
import com.baidu.fenfayun.demo.base.BaseFragment
import com.baidu.fenfayun.demo.base.BaseFragmentActivity
import com.baidu.fenfayun.demo.act.*
import com.baidu.fenfayun.demo.auth.*

import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
class MainAct :BaseFragmentActivity() {


   override fun getContextViewId():Int {
      return R.id.main
   }
   override fun  onCreate(savedInstanceState: Bundle? ) {
      super.onCreate(savedInstanceState)
      val   currentUser = UserSessionManager.getCurrentUser(this)
      if (currentUser == null) {
         val intent = Intent(this, LoginAct::class.java)
         startActivity(intent)
      }else{
         goHome()
      }
      /*startFragment(SearchFragment())*/
   }
   fun goHome(){
      val fragment = HomeFragment()
      getSupportFragmentManager()
      .beginTransaction()
      .add(getContextViewId(), fragment, fragment::class.simpleName)
      .addToBackStack(fragment::class.simpleName)
      .commit()
   }
}
